@extends('shared.master')

@section('content')
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <ol class="breadcrumb layout-title">
                                    <li class="active" ><i class="fa fa-user fa-fw"></i> Module</li>
            </ol>
            {{PageData::Error()}}
            <div class='panel-body row'>
                {{Form::button("Create New <i class='fa fa-plus'></i>",
                                array('class'=>'btn btn-primary pull-right',
                                'onClick'=>"location.href='".url('module/create')."'"))}}
            </div>
            <div class="">
                <table class="table table-striped table-bordered table-hover" id="tbl_data_user">
                    <thead>
                        <tr>
                            <td style="width: 70px !important;"></td>
                            <th>Nama</th>
                            <th>Icon</th>
                            <th>Sequence</th>
                            <th>Is Show</th>
                            <th>Is Enabled</th>
                        </tr>
                    </thead>
                    <tbody>
                        @if ($Model != null)
                            @foreach ($Model as $item)
                            <tr class="odd gradeX" onclick="">
                            <td class="text-center">
                                <div class="btn-group btn-group-sm" role="group" aria-label="...">
                                    <button type="button" class="btn btn-default"
                                            onclick="location.href='{{ action('ModuleController@edit', $item->getId()) }}'">
                                        <i class="fa fa-edit text-primary"></i>
                                    </button>
                                    <button type="button" class="btn btn-default" 
                                            onclick="var res = confirm('Are you sure want to delete this data?'); 
                                                if(res) location.href='{{ action('ModuleController@delete', $item->getId()) }}'">
                                        <i class="fa fa-trash text-primary"></i>
                                    </button>
                                </div>
                            </td>
                            <td><a href="{{ action('ModuleController@detail', $item->getId()) }}">{{ $item->getName() }}</a></td>
                            <td><i class="fa fa-{{ $item->getIcon() }}"></i> {{ $item->getIcon() }}</td>
                            <td class="text-center">{{ $item->getSequence() }}</td>
                            <td class="text-center">{{$item->getIsShow() ? "TRUE" : "FALSE" }}</td> 
                            <td class="text-center">{{$item->getIsEnabled() ? "TRUE" : "FALSE" }}</td>
                            </tr>
                            @endforeach
                        @endif
                    </tbody>
                </table>
            </div>
            <!-- /.table-responsive -->
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
</div>
<!-- /.container-fluid -->
<!-- Page-Level Demo Scripts - Tables - Use for reference -->
    <script>
    $(document).ready(function() {
        $('#tbl_data_user').dataTable(
//            {
//            'order': [[ 2, "asc" ]],
//            'language': {
//                'Paginate': {
//                    'First': "Pertama",
//                    'Last': "Terakhir",
//                    'Next': "Selanjutnya",
//                    'Previous': "Sebelumnya"
//                },
//                'lengthMenu': "Menampilkan _MENU_ record/halaman",
//                'zeroRecords': "Data tidak ditemukan - sorry",
//                'info': "Menampilkan halaman _PAGE_ dari _PAGES_",
//                'infoEmpty': "Data tidak tersedia",
//                'infoFiltered': "(Hasil filter dari _MAX_ total record)"
//            }
//        }
        );
    });
    </script>
@stop